package com.zcbl.toolkit.service;


import java.io.Serializable;

/**
 * @author He Peng
 * @create 2018-03-24 0:26
 * @update 2018-03-24 0:26
 * @updatedesc : 更新说明
 * @see
 */
public interface ServiceError extends Serializable {

    ServiceError SUCCESS = new ServiceError() {
        private int errorCode = 0;
        private String errorMsg = "Success";
        @Override
        public Integer getErrorCode() {
            return this.errorCode;
        }

        @Override
        public String getErrorMsg() {
            return this.errorMsg;
        }

        @Override
        public String toString() {
            return "ServiceError{" +
                    "errorCode=" + errorCode +
                    ", errorMsg='" + errorMsg + '\'' +
                    '}';
        }
    };

    ServiceError UNKNOWN_ERROR = new ServiceError() {

        private int errorCode = 1;
        private String errorMsg = "Unknown Error";
        @Override
        public Integer getErrorCode() {
            return this.errorCode;
        }

        @Override
        public String getErrorMsg() {
            return this.errorMsg;
        }

        @Override
        public String toString() {
            return "ServiceError{" +
                    "errorCode=" + errorCode +
                    ", errorMsg='" + errorMsg + '\'' +
                    '}';
        }
    };

    ServiceError ARG_ERROR = new ServiceError() {
        @Override
        public Integer getErrorCode() {
            return 2;
        }

        @Override
        public String getErrorMsg() {
            return "Bad Request Arg ";
        }
    };

    ServiceError SERVICE_ERROR = new ServiceError() {
        @Override
        public Integer getErrorCode() {
            return 3;
        }

        @Override
        public String getErrorMsg() {
            return "Service Error ";
        }
    };

    Integer getErrorCode();

    String getErrorMsg();
}
